package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.server.mapper.PhoneSmsRecordMapper;
import com.ybkj.daijia.server.model.PhoneSmsRecord;
import com.ybkj.daijia.server.service.PhoneSmsRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Shine
 */
@Service
public class DefaultPhoneSmsRecordService implements PhoneSmsRecordService {

    @Autowired
    private PhoneSmsRecordMapper phoneSmsRecordMapper;

    @Transactional(rollbackFor = Exception.class)
    public void save(PhoneSmsRecord phoneSmsRecord) {

        phoneSmsRecordMapper.insertRecord(phoneSmsRecord);

    }

    public PhoneSmsRecord findByPhone(String phone) {

        return phoneSmsRecordMapper.selectByPhone(phone);
    }

    @Transactional(rollbackFor = Exception.class)
    public void deleteByPhone(String phone) {

        phoneSmsRecordMapper.deleteByPhone(phone);
    }

    @Transactional(rollbackFor = Exception.class)
    public void update(PhoneSmsRecord phoneSmsRecord) {

        phoneSmsRecordMapper.updateByPrimaryKey(phoneSmsRecord);
    }

}
